import { IPSDataEntity } from '../ipsdata-entity';
import { IPSDEAction } from '../action/ipsdeaction';
import { IPSDEMainStateAction } from './ipsdemain-state-action';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSDEMainStateActionImpl extends PSModelObjectImpl implements IPSDEMainStateAction {
  get codeName(): string {
    return this.M.codeName;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  protected psdeaction: IPSDEAction | null = null;

  getPSDEAction(): IPSDEAction | null {
    if (this.psdeaction != null) return this.psdeaction;
    const value = this.M.getPSDEAction;
    if (value == null) {
      return null;
    }
    const ipsdataentity = this.getParentPSModelObject('dataentity.IPSDataEntity') as IPSDataEntity;
    if (ipsdataentity != null) {
      this.psdeaction = ipsdataentity.findPSDEAction(value);
    }
    return this.psdeaction;
  }

  get psDEAction(): IPSDEAction | null {
    return this.getPSDEAction();
  }

  getPSDEActionMust(): IPSDEAction {
    const value = this.getPSDEAction();
    if (value == null) {
      throw new Error('未指定实体行为');
    }
    return value;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get allowMode(): boolean {
    return this.M.allowMode;
  }

  get cls(): string {
    return 'PSDEMainStateActionImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'dataentity.mainstate.IPSDEMainStateAction') return true;
    return super.instanceof(cls);
  }
}
